package pkg

import (
	"github.com/golang-jwt/jwt/v5"
	"time"
)

type MyCustomClaims struct {
	id uint
	jwt.RegisteredClaims
}

func TokenGet(uid uint) (string, error) {
	mySigningKey := []byte("16e9e267828a6d8ad192b3eac3d328a8")

	// Create the Claims
	claims := MyCustomClaims{
		id: uid,
		RegisteredClaims: jwt.RegisteredClaims{
			Issuer:    "test",
			ExpiresAt: jwt.NewNumericDate(time.Now().Add(24 * time.Hour)),
		},
	}

	token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
	ss, err := token.SignedString(mySigningKey)
	return ss, err
}
